#!/usr/bin/env node

//const Read = require('stream').Readable;
const { Readable } = require('stream');
//  log = console.log;

const rs = new Readable();
let c = 'a'.charCodeAt(0);

//因为_read变成拉取流
rs._read = () => {
  rs.push(String.fromCharCode(c++));
  if(c === 'z'.charCodeAt(0)+1)
    rs.push(null);
  
  //rs.push('hello');
  //res.push('null');

};
//放入管道，输出read方法第一个，再输出输出流；到z关闭（循环）
//被动流
rs.pipe(process.stdout);
